import { observable, autorun } from "mobx";

const todos = observable([
  { title: "spoil tea", completed: true },
  { title: "make coffee", completed: false },
]);

autorun(() => {
  const titles = todos
    .filter((todo) => !todo.completed)
    .map((todo) => todo.title)
    .join(", ");
  console.log("titles:", titles);
});

todos[0].completed = false;

todos[2] = { title: "take a nap", completed: false };

todos.shift();
